{% extends '@Admin/adminFramework/example/list.html.twig' %}
{% import "@Admin/adminFramework/loader/model.loader.twig" as loader_model %}
{% import "@Admin/adminFramework/loader/base.loader.twig" as loader_base %}
{% import "@Admin/adminFramework/loader/control.loader.twig" as loader_control %}

{% block action %}
    {% block action_insert %}
        {{ loader_control.a('添加', 'button', 'btn btn-success btn-add', ' href="' ~ path('admin_assignment_info') ~ '" ') | raw }}
    {% endblock %}
{% endblock %}


{% block before %}
    {{ loader_model.load_navigation('权限分配列表', '权限管理', { '权限分配列表': '' }) }}
{% endblock %}


{% block title %}列表{% endblock %}

{% block filtrate %}
{% endblock %}

{% block th %}
    <th>序号</th>
    <th>账号</th>
    <th>姓名</th>
    <th>权限</th>
    <th width="35%">操作</th>
{% endblock %}

{% block td %}
    <td>{{ loader_control.xuhao(item) }}</td>
    <td>{{ value.account }}</td>
    <td>{{ value.name }}</td>
    <td>{{ value.roles}}</td>
    <td>
        {% if value.admin == false %}
            {{ loader_control.a('权限分配', '', 'btn btn-success', 'href="' ~ path('admin_assignment_show', {id: value.id}) ~ '"') }}
        {% else %}

        {% endif %}
        {% if value.admin == false %}

            <a class="btn btn-danger del-notic edit" data-id="{{ value.id }}">删除</a>
        {% else %}

        {% endif %}
        <a class="btn btn-primary" href="{{ path('admin_assignment_info') }}?id={{ value.id }}">编辑</a>
    </td>
{% endblock %}

{% block jquery %}
    {{ parent() }}
    <script>
        $('.edit').click(function () {
            var id = $(this).data('id');
            if(confirm('是否对帐号进行删除？')){
                $.post("{{ path('admin_assignment_accountdelete')}}?id=" + id,{},function(result){
                    alert(result.message.message);
                    if(result.errorCode == 0) {
                        window.location.reload();
                    }
                    if(result.errorCode == -1) {
                        window.location.href = result.data.go_url;
                    }

                });
            }
        });
    </script>

{% endblock %}